home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cujoct93.zip / 1110084B < prev    next >
Text File  |  1993-08-10  |  546b  |  26 lines

  1. /* menu.c:  Illustrates arrays of functions */
  2.  
  3. #include <stdio.h>
  4.  
  5. /* You must provide definitions for these */
  6. extern void retrieve(void);
  7. extern void insert(void);
  8. extern void update(void);
  9. extern int show_menu(void);
  10.  
  11. main()
  12. {
  13.     int choice;
  14.     void (*farray[])(void) = {retrieve,insert,update};
  15.  
  16.     for (;;)
  17.     {
  18.         choice = show_menu();
  19.         if (choice >= 1 && choice <= 3)
  20.             farray[choice-1]();     /* Process request */
  21.         else if (choice == 4)
  22.             break;
  23.     }
  24.     return 0;
  25. }
  26.